package com.web.ShoppingDemo.daoImpl;


import java.util.List;

import org.springframework.stereotype.Repository;

import com.web.ShoppingDemo.dao.SorderDao;
import com.web.ShoppingDemo.model.Sorder;

@Repository("sorderDao")
public class SorderDaoImpl extends BaseDaoImpl<Sorder> implements
		SorderDao {

	@SuppressWarnings("unchecked")
	@Override
	public List<Object> querySale(int number) {
		String hql = "SELECT s.name,sum(s.number) FROM Sorder s JOIN s.product GROUP BY s.product.id";
		return getSession().createQuery(hql).setFirstResult(0).setMaxResults(number).list();
	}

}
